home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / smaltalk / manchest.lha / MANCHESTER / manchester / 4.1 / structureString.st < prev    next >
Text File  |  1993-07-24  |  2KB  |  64 lines

  1. "    NAME        structureString
  2.     AUTHOR        Bernard Horan <bernard@is.morgan.com>
  3.     CONTRIBUTOR    Bernard Horan <bernard@is.morgan.com>
  4.     FUNCTION      print out indented string of a visualComponent structure
  5.     ST-VERSIONS    4.1
  6.     PREREQUISITES     
  7.     CONFLICTS     
  8.     DISTRIBUTION    world
  9.     VERSION        1.0
  10.     DATE        May 1993
  11.     SUMMARY        I created these few methods to help me find my
  12. way around fairly complex visual part structures. Rather than using
  13. the grapher tool (see this archive), I needed a string representation
  14. of the structure. Tabs are used to create an indented representation,
  15. following the composition of the visual components. To see an example,
  16. inspect the browser and print the result of sending the message
  17. #structureString to the topmost component (not the window). BH,
  18. 7/5/93"!
  19.  
  20. 'From Objectworks\Smalltalk(R), Release 4.1 of 15 April 1992 on 1 September 1992 at 7:02:36 am'!
  21.  
  22.  
  23.  
  24. !CompositePart methodsFor: 'printing'!
  25.  
  26. printStructureOn: aStream indent: anIndent
  27.     super printStructureOn: aStream indent: anIndent.
  28.     components do: [:c | c printStructureOn: aStream indent: anIndent + 1]! !
  29.  
  30.  
  31. !BorderDecorator methodsFor: 'printing'!
  32.  
  33. printStructureOn: aStream indent: anIndent
  34.     super printStructureOn: aStream indent: anIndent.
  35.     component printStructureOn: aStream indent: anIndent + 1! !
  36.  
  37.  
  38. !Wrapper methodsFor: 'printing'!
  39.  
  40. printStructureOn: aStream indent: anIndent
  41.     super printStructureOn: aStream indent: anIndent.
  42.     component printStructureOn: aStream indent: anIndent + 1! !
  43.  
  44.  
  45. !VisualComponent methodsFor: 'printing'!
  46.  
  47. printStructureOn: aStream indent: anIndent
  48.     anIndent timesRepeat: [aStream tab].
  49.     aStream nextPut: ${.
  50.     self printOn: aStream.
  51.     aStream nextPut: $}.
  52.     aStream space.
  53.     self bounds printOn: aStream.
  54.     aStream cr.!
  55.  
  56. structureString
  57.     | stream |
  58.     stream := String new writeStream.
  59.     self printStructureOn: stream indent: 0.
  60.     stream skip: -1.
  61.     ^ stream contents! !
  62.  
  63.  
  64.